if (location.pathname !== '/login.html') {
  $.ajax({
    type: 'get',
    url: '/api/auth',
    success: function (result) {
      if (result.code === -1) {
        layer.msg(result.info, {icon: 5}, function () {
          location.href = '/login.html'
        })
      }else {
        $('#admin').text(result.data.username +' - '+ result.data.name)
      }
    },
    dataType: 'json'
  })

}


function logout(){
  $.ajax({
    type: 'get',
    url: '/api/logout',
    success: function (result) {
        layer.msg(result.info, {icon: 6}, function () {
          location.href = '/login.html'
      })
    },
    dataType: 'json'
  })

}
